package com.ysd.lis.controller.sys;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.SysExtenFields;
import com.ysd.lis.request.ExtenFieldsPageRequestDto;
import com.ysd.lis.request.SaveExtenFieldsEditRequestDto;
import com.ysd.lis.service.SysExtenFieldsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Cfz
 * @since 2023-12-20
 */
@Api(value = "扩展属性")
@RestController
@RequestMapping("/api/sys/sysextenfields")
public class SysExtenFieldsController extends BaseController {
    @Autowired
    SysExtenFieldsService sysExtenFieldsService;

    @ApiOperation("获取扩展属性")
    @GetMapping("/findExtenFieldsList")
    public Result findExtenFieldsList(@RequestBody ExtenFieldsPageRequestDto pageParam) {
        return sysExtenFieldsService.findExtenFieldsList(pageParam);
    }

    @ApiOperation("获取扩展属性结构数据")
    @GetMapping("/findEditExtenFieldsList")
    public Result findEditExtenFieldsList(ExtenFieldsPageRequestDto pageParam) throws JsonProcessingException {
        return sysExtenFieldsService.findEditExtenFieldsList(pageParam);
    }

    @ApiOperation("保存扩展属性")
    @PostMapping("/saveEditExtenFieldsList")
    public Result saveEditExtenFieldsList(@RequestBody SaveExtenFieldsEditRequestDto input) throws JsonProcessingException {
        return sysExtenFieldsService.saveEditExtenFieldsList(input);
    }

    @ApiOperation("添加扩展属性")
    @PostMapping("/addExtenFields")
    public Result addExtenFields(@RequestBody SysExtenFields ExtenFields) {
        return sysExtenFieldsService.addExtenFields(ExtenFields);
    }

    @ApiOperation("编辑扩展属性")
    @PostMapping("/editExtenFields")
    public Result editExtenFields(@RequestBody SysExtenFields ExtenFields) {
        return sysExtenFieldsService.editExtenFields(ExtenFields);
    }

    @ApiOperation("删除扩展属性")
    @PostMapping("/deleteExtenFields")
    public Result deleteExtenFields(@RequestBody SysExtenFields ExtenFields) {
        return sysExtenFieldsService.deleteExtenFields(ExtenFields);
    }
}
